home *** CD-ROM | disk | FTP | other *** search
- library serverpush;
-
- { Important note about DLL memory management: ShareMem must be the
- first unit in your library's USES clause AND your project's (select
- View-Project Source) USES clause if your DLL exports any procedures or
- functions that pass strings as parameters or function results. This
- applies to all strings passed to and from your DLL--even those that
- are nested in records and classes. ShareMem is the interface unit to
- the DELPHIMM.DLL shared memory manager, which must be deployed along
- with your DLL. To avoid using DELPHIMM.DLL, pass string information
- using PChar or ShortString parameters. }
-
- uses
- Windows, SysUtils, Classes, Httpext;
-
-
-
- // CASE MATTERS FOR THIS FUNCTION NAME
- function GetExtensionVersion(var ver: THSE_VERSION_INFO): Boolean; stdcall;
- begin
- result:=True;
- end;
-
- // CASE MATTERS FOR THIS FUNCTION NAME
- function HttpExtensionProc(var ecb: TEXTENSION_CONTROL_BLOCK): LongInt; stdcall;
- var
- FN_Write: TWriteClientProc;
- s: String;
- len: Integer;
- begin
- // Get the callback function
- @FN_Write:=@ecb.WriteClient;
-
- s:='HTTP/1.0 200'#13#10; len:=Length(s); FN_WRITE(ecb.ConnID, PChar(s), len, 0);
- s:='Content-type: multipart/x-mixed-replace;boundary=--TERM'#13#10#13#10; len:=Length(s); FN_WRITE(ecb.ConnID, PChar(s), len, 0);
- repeat
- s:='--TERM'#13#10; len:=Length(s); FN_WRITE(ecb.ConnID, PChar(s), len, 0);
- s:='Content-type: text/html'#13#10#13#10; len:=Length(s); FN_WRITE(ecb.ConnID, PChar(s), len, 0);
- s:='<title>ISAPI Generated Page (serverpush.dll)</title>'#13#10; len:=Length(s); FN_WRITE(ecb.ConnID, PChar(s), len, 0);
- s:='<body><h1>Server Push Demo</h1>'#13#10; len:=Length(s); FN_WRITE(ecb.ConnID, PChar(s), len, 0);
- s:='<h3>'+FormatDateTime('ddd, dd mmm yyyy hh:nn:ss "GMT"', Now)+'</h3></body>'#13#10;len:=Length(s); FN_WRITE(ecb.ConnID, PChar(s), len, 0);
- Sleep(1000);
- until (FALSE) OR (len=0);
- end;
-
- // * REQUIRED FOR DYNAMIC BINDING.
- // * Index values aren't need.
- // * Case doesn't matter here.
- exports
- GetExtensionVersion,
- HttpExtensionProc;
-
- begin
- end.
-